package com.kotasoft.training.roogwteclipselink.client.managed.ui;

import com.google.gwt.requestfactory.ui.client.ProxyRenderer;

import com.kotasoft.training.roogwteclipselink.client.managed.request.DireccionProxy;

/**
 * Renders {@link DireccionProxy for display to the user. Requires the
 *  properties to have been fetched.
 */
public class DireccionProxyRenderer extends ProxyRenderer<DireccionProxy> {
  private static DireccionProxyRenderer INSTANCE;

  public static DireccionProxyRenderer instance() {
    if (INSTANCE == null) {
      INSTANCE = new DireccionProxyRenderer();
    }

    return INSTANCE;
  }

  protected DireccionProxyRenderer() {
    super(new String[] {"tipoVia"});
  }

  public String render(DireccionProxy object) {
    if (object == null) {
      return "";
    }
    return object.getTipoVia() + " (" + object.getId() + ")";
  }
}
